﻿package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓


	//沙箱APPID
	public static final  String app_id = "2016092100561313";
	//沙箱私钥
	public static final  String merchant_private_key =  
			"MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDD639ns4Yqv+9xOMG5WVphVscA8yAeJXp+qWvD0FaP/WmkqlunkUZWrmvN3p5I0PCfQ5N5ttWv+WtbikFSNnnwJmO0xv5lj89Fl/A1BJUH3eiOkEO/YZi8LV8ZtyFVR8xT+CG4a4tWUEDzA0As8zJUJxusRcEkU0bxnlM1VSnVF+4alpiNNdAhHAqQm59LG+N+Q8TAcNU3Hhz1k45YhaiyE/Z3EluwpCk1BfkCqdBvUadB8X5wTbz/ID6KDT/Bj5K5p1ER4cKg+VCOwBt62QYzzvmO1kRgFAoVG6wv/FwqhyZ0TvMraOhAqav0VVue4Ja7UeT21/SrFKxncnZiowehAgMBAAECggEBALwh49Hc3jUm4fLDIaOuXc+i2K3cyTapnpsKbWU3JihWm593x1N9eSG7k+G4qB4cJTOKXI9ANqooxCK+/ELJ9QXal1v8ykUUd2DIqez/XWyUdsCPX77jJRtuJig3ZlbR/y+S0i6Zds+HeRbiRDnlvqp4c2ZWBUWwgit6cUSBZw4rns7rfijPqN3d/zRI/y2CibAIayLSO1vS9gaTeKQ/jN+iQUV7KPNZ8mXo+W3nbvqZTXpE760ofXdA3MN5CbUeu8VDFxu1hBc4MvBYgd2BRhQPkA06DGxyFkZnsmc3fZ6SkMTxtRgiDNx3nN10jMR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I/YVz8jLOb5tb7ZI2oQjpF3SwAhZ1xRMlrJy8wvq6D4be2bBucaP+ZwMxpUsJFuPzoh7M/TKww77Bs3KdnBHqb27roOf2adGMyBKLVqG5Ak6HeHZqnWsxMj/X7mZLYUD3it+8K6PTX5x96uA+ATKlC3RpEmnBHf8PA9t+zr5KzdjQrA0P9p8XXk1zYJeub1BKHhD6/0dhcIfWQA1mh67GmYUF3AOlAOk5UmdRjhIHISqwIDAQAB";
	//沙箱网关地址
	public static final  String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

//	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8099/xiaomiMarket/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

//	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp
	public static String return_url = "http://localhost:8099/xiaomiMarket/index.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";

	
	// 支付宝网关
	public static String log_path = "https://openapi.alipaydev.com/gateway.do";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

